package org.ruizhijie.i.impl;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ruizhijie.Main;
import org.ruizhijie.config.TopicQueue;
import org.ruizhijie.i.IPublisher;

public class InComPublisherImpl implements IPublisher{
	private Logger log = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
	private TopicQueue tq;
	
	public InComPublisherImpl(TopicQueue tq){
		this.tq=tq;
	}

	@Override
	public void publish(String topic, byte[] msg) {
		log.info("收到串口消息: "+topic+" "+msg.toString());
		tq.update(topic, msg);
		tq.update(Main.TOPIC_COMMON, msg);
	}
}
